rm(list = ls())
gc()
set.seed(63296)
packages <-c("readstata13","ggplot2")

new.packages <- packages[!(packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)

lapply(packages, require, character.only = TRUE)
rm(packages, new.packages)

setwd("PUT YOUR DIRECTORY HERE")

## load data
data <- read.csv("./Datasets/falsification_lower_silesia.csv")

###################
### REGRESSIONS ###
###################

## OLS
m_strikes_ols <- lm(scale(strikes) ~ dist_closest_priest, data = data)


## save in tex
stargazer(m_strikes_ols, 
          dep.var.labels = c("Protests (z)"),
          style = "qje",
          covariate.labels = c("Distance to corrupted priests"),
          star.char = c("*", "**", "***"),
          star.cutoffs = c(0.1, 0.05, 0.01),
          omit = c("Constant"),
          omit.stat = c("rsq", "f", "ser"), 
          omit.table.layout = "n",
          add.lines = list(c("Fixed effects", "No", "No"),
                           c("Controls", "No", "No")),
          out = "PUT YOUR FILEPATH HERE")




